﻿function pageLoad(sender, args) {
    if (window.contentPageLoad) {
        window.contentPageLoad(sender, args);
    }
}

function ShowMsg(msg, fn, params) {
    $("#dialog")[0].innerHTML = "<p>" + msg.toString() + "</p>"
    $("#dialog").dialog({
        autoOpen: false,
        width: 400,
        draggable: false,
        close: function () {
            document.getElementById("dialog").innerHTML = "";
            if (typeof (onClosedMsg) != "undefined") {
                onClosedMsg();
            }
        },
        buttons: [
				{
				    text: "Aceptar",
				    click: function () {
				        $(this).dialog("close");
				        if (typeof (fn) != "undefined") {
				            if (fn != null) {
				                if (typeof (params) == "undefined") {
				                    fn();
				                }
				                else {
				                    if (paramsOk != null) {
				                        switch (params.length) {
				                            case 0:
				                                fn();
				                                break;
				                            case 1:
				                                fn(params[0]);
				                                break;
				                            case 2:
				                                fn(params[0], params[1]);
				                                break;
				                            case 3:
				                                fn(params[0], params[1], params[2]);
				                                break;
				                            case 4:
				                                fn(params[0], params[1], params[2], params[3]);
				                                break;
				                            case 5:
				                                fn(params[0], params[1], params[2], params[3], params[4]);
				                                break;
				                            case 6:
				                                fn(params[0], params[1], params[2], params[3], params[4], params[5]);
				                                break;
				                            case 7:
				                                fn(params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
				                                break;
				                            case 8:
				                                fn(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7]);
				                                break;
				                            case 9:
				                                fn(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8]);
				                                break;
				                            case 10:
				                                fn(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8], params[9]);
				                                break;
				                        }
				                    }
				                }
				            }
				        }
				    }
				}
			]
    });
    $("#dialog").dialog("open");
}